package com.vf.admin.client.dao;

import com.vf.admin.common.db.BaseDao;
import com.vf.admin.common.splitpage.SplitPageBean;
import com.vf.admin.miaodong.entity.ExchangeGoldDiamonds;
import com.vf.admin.miaodong.entity.VipPackage;
import org.springframework.stereotype.Repository;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;

@Repository
public class VipPackageDao extends BaseDao<VipPackage> {

    public List<VipPackage> page(Map<String, Object> paraMap, SplitPageBean splitPage) {
        ArrayList<Object> paramList = new ArrayList<>();
        StringBuilder sbStr = new StringBuilder("select * from vip_package where 1=1");

        String sql = sbStr.toString();
        return this.queryList(sql, paramList, VipPackage.class, splitPage);
    }

    public List<VipPackage> list() {
        StringBuilder sbStr = new StringBuilder("select * from vip_package order by sort asc");
        String sql = sbStr.toString();
        return this.queryList(sql, new ArrayList<>(), VipPackage.class);
    }

    public void saveOrUpdate(VipPackage haoYou) {
        if (haoYou.getId() != null && haoYou.getId() > 0) {
            this.update(haoYou);
        } else {
            haoYou.setId(this.add(haoYou));
        }
    }

}
